Skip to content

Conversation

kaixuanliu
Copy link
Contributor

@regisss @Narsil pls help review

return FlashBert(model_path, device, datatype)
try:
return FlashBert(model_path, device, datatype)
except:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can catch the specific error linked to no safetensors file rather than catching everything?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the main purpose is to make the model run smoothly first, hence no matter whether it is an error caused by no safetensor file or sth else, we can use DefaultModel path to do the backup choice. WDYT?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem here is that we risk missing completely unrelated errors, which is not good.
Thinking about it more, I don't get why DefaultModel would work in this case and not FlashBert. Can you send a command to reproduce it and the logs of the error please?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DefaultModel path uses transformers modeling while FlashBert implements modeling itself, and it reads weight file from safetensors L305, for some models they do not have this file, which will cause the error.
Cmd line to reproduce:
docker run -p 8080:80 -v $volume:/data --network host --runtime=habana -e HABANA_VISIBLE_DEVICES=all -e MAX_WARMUP_SEQUENCE_LENGTH=512 -e OMPI_MCA_btl_vader_single_copy_mechanism=none --cap-add=sys_nice --ipc=host tei_hpu --model-id BAAI/bge-base-zh-v1.5 --dtype bfloat16 --auto-truncate --pooling cls

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have updated the try ... except ... part.

Signed-off-by: Liu, Kaixuan <[email protected]>
@kaixuanliu
Copy link
Contributor Author

@regisss Hi, I have updated the code, pls have a review.

@Narsil
Copy link
Collaborator

Narsil commented Mar 26, 2025

LGTM Thanks for this contribution.

Not using safetensors is considered a bug at this point given the magnitude of the security implementations.
But running legacy models is still a thing.

@Narsil Narsil merged commit d8771f8 into huggingface:main Mar 26, 2025
@kaixuanliu kaixuanliu deleted the flashBert-fix branch March 27, 2025 00:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants